package src.lanqiao.true_question_F;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;

public class Main {
    public static void main(String[] args) throws IOException {
        int x = MyReader.nextInt();
        int absx = Math.abs(x);
        int y = MyReader.nextInt();
        int absy = Math.abs(y);

        int n = Math.max(absx - 1, absy - 1);
        long sn = 4L * n * n + 4L * n;
        int sa = 0;
        if(absx > absy) {
            int a = 2 * absx;
            if (x < 0)
                sa = y - x;
            else
                sa = 2 * a + x - y;
        }else {
            int a = 2 * absy;
            if (y < 0)
                sa = 3 * a - y - x;
            else
                sa = a + x + y;
        }
        long sum = sn + sa;
        System.out.println(sum);
    }
}


class MyReader{
    static BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));//定义字符流
    static StringTokenizer tokenizer = new StringTokenizer("");
    static String nextLine() throws IOException {// 读取下一行字符串
        return reader.readLine();
    }
    static String next() throws IOException {// 读取下一个字符串
        while (!tokenizer.hasMoreTokens()) {
            tokenizer = new StringTokenizer(reader.readLine());
        }
        return tokenizer.nextToken();
    }

    static int nextInt() throws IOException {// 读取下一个int型数值
        return Integer.parseInt(next());
    }

    static double nextDouble() throws IOException {// 读取下一个double型数值
        return Double.parseDouble(next());
    }
}